import Vue from "vue";
import Vuex from "vuex";
import cloneDeep from "lodash/cloneDeep";
import designer from "./modules/designer";
import generator from "./modules/generator";
import dict from "@/plugin/pl-base/pl-dict/store/modules/dict";
import getters from "./getters";

Vue.use(Vuex);

export default new Vuex.Store({
  modules: {
    designer,
    generator,
    dict
  },
  getters,
  mutations: {
    // 重置vuex本地储存状态
    resetStore(state) {
      Object.keys(state).forEach((key) => {
        state[key] = cloneDeep(window.SITE_CONFIG["storeState"][key]);
      });
    },
  },
});
